import {
  mapGetters
} from 'vuex'
export default {
  computed: {
    ...mapGetters('m_cart',['total'])
  },
  watch: {
    total() {
      this.setBadge()
    }
  },
  onShow() {
    this.setBadge();
  },
  methods: {
    // 为购物车tabbar右上角设置数量标识
    setBadge() {
      uni.setTabBarBadge({
        index: 2,
        text: this.total + ''
      })
    }
  }
}
